#ifndef __CMS_UTILS_A3KG1SY5
#define __CMS_UTILS_A3KG1SY5

#ifndef TABSIZE
#define TABSIZE(obj)	(sizeof(obj)/sizeof(*obj))
#endif

#ifndef IFNAME_SIZE
#define IFNAME_SIZE 16
#endif

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a)	(sizeof(a)/sizeof(a[0]))
#endif


typedef enum {
	LAN_DEV_PHONE = 1,
	LAN_DEV_PAD = 2,
	LAN_DEV_PC = 3,
	LAN_DEV_STB = 4,
	LAN_DEV_AP = 5,
	LAN_DEV_OTHER = 6,
	LAN_DEV_FTTR_ROUTER = 7,
	LAN_DEV_IOT = 8,
	LAN_DEV_IOT_CAMERA = 9,
	LAN_DEV_ELINK = 10 		/* China CTC eLink */
} LanDeviceType;

        

static __inline__ void get_mac_str_from_bytes(char *str, uint8_t *mac)
{
	sprintf(str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
		mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}

static __inline__ int get_mac_bytes_from_str(uint8_t *mac, const char *str)
{
	uint8_t mac_t[MAC_LENGTH];
	if(sscanf(str, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
					&mac_t[0], &mac_t[1], &mac_t[2], &mac_t[3], &mac_t[4], &mac_t[5]) < 6){
        return CMS_NOK;
    }

    memcpy(mac, mac_t, MAC_LENGTH);

	return CMS_OK;
}



/* common API */
int cms_is_hex_string(char *input_str);
void cmsReplace(char *s, char what, char with);
int generateName(uint32_t wanIndex,char *ServiceList, char *ConnectionType,uint16_t VLANID, uint8_t VLANMode, char *wanpon_connectname);
unsigned int Cms_getpvcIndex(cmsXmlCb_t *xmlShmCb);
int my_localtime(char *timezone,char *currenttime);
int getzeroconfiggponstate(void);
int getzeroconfigeponstate(void);
int isValidMac(uint8_t *mac);
char *getPreDefaultXml(void);
void getAreaAndProvince(char *area, char *province);



#endif /* end of include guard: __CMS_UTILS_A3KG1SY5 */
